import {getCategoryList} from '@/api';

const state = {
  categoryList: [],
};
const mutations = {
  SET_CATEGORYLIST_STATE(state, payload) {
    state.categoryList = payload.categoryList;
  },
};
const actions = {
  async getCategoryList({commit}) {
    //发送请求
    const result = await getCategoryList();

    commit('SET_CATEGORYLIST_STATE', {categoryList: result});
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
